using System;
using System.Data;
using System.Collections;

namespace APP.QUANLY.Entity
{
     /// <summary>
     /// Summary description for MATHANG.
     /// </summary>
     public class MATHANG
    {
              private Int32 _MAMATHANG;
      private string _MABARCODE;
      private string _MACODE;
      private string _TENMATHANG;
      private byte[] _HINHANH;
      private Int32 _MADONVISI;
      private Int32 _MADONVILE;
      private Int32 _SOLUONGQUYDOI;
      private Int32 _VAT;
      private double _CHIETKHAU;
      private string _XUATXU;
      private decimal _GIANHAP;
      private decimal _GIALE;
      private decimal _GIAQUYDINH;
      private decimal _GIACHIATHANG;
      private decimal _GIAKHUYENMAI;
      private decimal _NGUONGNHAP;
      private decimal _NGUONGXUAT;
      private bool _ISKHUYENMAI;
      private bool _ISUSE;
      private bool _ISDELETE;
      private bool _ISTHEODOI;
      private DateTime _NGAYTAO;
      private string _NGUOITAO;
      private DateTime _NGAYCAPNHAT;
      private string _NGUOICAPNHAT;
      private Int32 _MALOAIMATHANG;
      private string _GHICHU;
      private HOADONXUATKHOCHITIETList _listHOADONXUATKHOCHITIET;
      private HOADONHAPKHOCHITIETList _listHOADONHAPKHOCHITIET;
      private KHOMATHANGList _listKHOMATHANG;
      private MATHANGKHUYENMAIList _listMATHANGKHUYENMAI;
        private bool isExisting;
        #region Properties
        public bool IsExisting
        {
              get{return isExisting;}
              set{isExisting = value;}
        }
		      public bool IsMAMATHANGNullable
      { get { return false;  } }
      public Int32 MAMATHANG
      {
         get { return _MAMATHANG; }
         set { _MAMATHANG = value; }
      }
      public bool IsMABARCODENullable
      { get { return true;  } }
      public string MABARCODE
      {
         get { return _MABARCODE;  }
         set { _MABARCODE = value; }
      }
      public bool IsMACODENullable
      { get { return true;  } }
      public string MACODE
      {
         get { return _MACODE;  }
         set { _MACODE = value; }
      }
      public bool IsTENMATHANGNullable
      { get { return true;  } }
      public string TENMATHANG
      {
         get { return _TENMATHANG;  }
         set { _TENMATHANG = value; }
      }
      public bool IsHINHANHNullable
      { get { return true;  } }
      public byte[] HINHANH
      {
         get { return _HINHANH;  }
         set { _HINHANH = value; }
      }
      public bool IsMADONVISINullable
      { get { return true;  } }
      public Int32 MADONVISI
      {
         get { return _MADONVISI;  }
         set { _MADONVISI = value; }
      }
      public bool IsMADONVILENullable
      { get { return true;  } }
      public Int32 MADONVILE
      {
         get { return _MADONVILE;  }
         set { _MADONVILE = value; }
      }
      public bool IsSOLUONGQUYDOINullable
      { get { return true;  } }
      public Int32 SOLUONGQUYDOI
      {
         get { return _SOLUONGQUYDOI;  }
         set { _SOLUONGQUYDOI = value; }
      }
      public bool IsVATNullable
      { get { return true;  } }
      public Int32 VAT
      {
         get { return _VAT;  }
         set { _VAT = value; }
      }
      public bool IsCHIETKHAUNullable
      { get { return true;  } }
      public double CHIETKHAU
      {
         get { return _CHIETKHAU;  }
         set { _CHIETKHAU = value; }
      }
      public bool IsXUATXUNullable
      { get { return true;  } }
      public string XUATXU
      {
         get { return _XUATXU;  }
         set { _XUATXU = value; }
      }
      public bool IsGIANHAPNullable
      { get { return true;  } }
      public decimal GIANHAP
      {
         get { return _GIANHAP;  }
         set { _GIANHAP = value; }
      }
      public bool IsGIALENullable
      { get { return true;  } }
      public decimal GIALE
      {
         get { return _GIALE;  }
         set { _GIALE = value; }
      }
      public bool IsGIAQUYDINHNullable
      { get { return true;  } }
      public decimal GIAQUYDINH
      {
         get { return _GIAQUYDINH;  }
         set { _GIAQUYDINH = value; }
      }
      public bool IsGIACHIATHANGNullable
      { get { return true;  } }
      public decimal GIACHIATHANG
      {
         get { return _GIACHIATHANG;  }
         set { _GIACHIATHANG = value; }
      }
      public bool IsGIAKHUYENMAINullable
      { get { return true;  } }
      public decimal GIAKHUYENMAI
      {
         get { return _GIAKHUYENMAI;  }
         set { _GIAKHUYENMAI = value; }
      }
      public bool IsNGUONGNHAPNullable
      { get { return true;  } }
      public decimal NGUONGNHAP
      {
         get { return _NGUONGNHAP;  }
         set { _NGUONGNHAP = value; }
      }
      public bool IsNGUONGXUATNullable
      { get { return true;  } }
      public decimal NGUONGXUAT
      {
         get { return _NGUONGXUAT;  }
         set { _NGUONGXUAT = value; }
      }
      public bool IsISKHUYENMAINullable
      { get { return true;  } }
      public bool ISKHUYENMAI
      {
         get { return _ISKHUYENMAI;  }
         set { _ISKHUYENMAI = value; }
      }
      public bool IsISUSENullable
      { get { return true;  } }
      public bool ISUSE
      {
         get { return _ISUSE;  }
         set { _ISUSE = value; }
      }
      public bool IsISDELETENullable
      { get { return true;  } }
      public bool ISDELETE
      {
         get { return _ISDELETE;  }
         set { _ISDELETE = value; }
      }
      public bool IsISTHEODOINullable
      { get { return true;  } }
      public bool ISTHEODOI
      {
         get { return _ISTHEODOI;  }
         set { _ISTHEODOI = value; }
      }
      public bool IsNGAYTAONullable
      { get { return true;  } }
      public DateTime NGAYTAO
      {
         get { return _NGAYTAO;  }
         set { _NGAYTAO = value; }
      }
      public bool IsNGUOITAONullable
      { get { return true;  } }
      public string NGUOITAO
      {
         get { return _NGUOITAO;  }
         set { _NGUOITAO = value; }
      }
      public bool IsNGAYCAPNHATNullable
      { get { return true;  } }
      public DateTime NGAYCAPNHAT
      {
         get { return _NGAYCAPNHAT;  }
         set { _NGAYCAPNHAT = value; }
      }
      public bool IsNGUOICAPNHATNullable
      { get { return true;  } }
      public string NGUOICAPNHAT
      {
         get { return _NGUOICAPNHAT;  }
         set { _NGUOICAPNHAT = value; }
      }
      public bool IsMALOAIMATHANGNullable
      { get { return true;  } }
      public Int32 MALOAIMATHANG
      {
         get { return _MALOAIMATHANG;  }
         set { _MALOAIMATHANG = value; }
      }
      public bool IsGHICHUNullable
      { get { return true;  } }
      public string GHICHU
      {
         get { return _GHICHU;  }
         set { _GHICHU = value; }
      }
public HOADONXUATKHOCHITIETList HOADONXUATKHOCHITIETList 
{ 
	get { return _listHOADONXUATKHOCHITIET; }
	set { _listHOADONXUATKHOCHITIET = value;}
}
public HOADONHAPKHOCHITIETList HOADONHAPKHOCHITIETList 
{ 
	get { return _listHOADONHAPKHOCHITIET; }
	set { _listHOADONHAPKHOCHITIET = value;}
}
public KHOMATHANGList KHOMATHANGList 
{ 
	get { return _listKHOMATHANG; }
	set { _listKHOMATHANG = value;}
}
public MATHANGKHUYENMAIList MATHANGKHUYENMAIList 
{ 
	get { return _listMATHANGKHUYENMAI; }
	set { _listMATHANGKHUYENMAI = value;}
}

        #endregion

        #region Constructors
        public MATHANG()
        {
            Reset();
        }
        public MATHANG(MATHANG obj)
        {
            	this._MAMATHANG = obj.MAMATHANG;
	this._MABARCODE = obj.MABARCODE;
	this._MACODE = obj.MACODE;
	this._TENMATHANG = obj.TENMATHANG;
	this._HINHANH = obj.HINHANH;
	this._MADONVISI = obj.MADONVISI;
	this._MADONVILE = obj.MADONVILE;
	this._SOLUONGQUYDOI = obj.SOLUONGQUYDOI;
	this._VAT = obj.VAT;
	this._CHIETKHAU = obj.CHIETKHAU;
	this._XUATXU = obj.XUATXU;
	this._GIANHAP = obj.GIANHAP;
	this._GIALE = obj.GIALE;
	this._GIAQUYDINH = obj.GIAQUYDINH;
	this._GIACHIATHANG = obj.GIACHIATHANG;
	this._GIAKHUYENMAI = obj.GIAKHUYENMAI;
	this._NGUONGNHAP = obj.NGUONGNHAP;
	this._NGUONGXUAT = obj.NGUONGXUAT;
	this._ISKHUYENMAI = obj.ISKHUYENMAI;
	this._ISUSE = obj.ISUSE;
	this._ISDELETE = obj.ISDELETE;
	this._ISTHEODOI = obj.ISTHEODOI;
	this._NGAYTAO = obj.NGAYTAO;
	this._NGUOITAO = obj.NGUOITAO;
	this._NGAYCAPNHAT = obj.NGAYCAPNHAT;
	this._NGUOICAPNHAT = obj.NGUOICAPNHAT;
	this._MALOAIMATHANG = obj.MALOAIMATHANG;
	this._GHICHU = obj.GHICHU;
        }
        #endregion

        public void Reset()
        {
                     _MAMATHANG = EmptyValues.v_Int32;
         _MABARCODE = EmptyValues.v_string;
         _MACODE = EmptyValues.v_string;
         _TENMATHANG = EmptyValues.v_string;
         _HINHANH = EmptyValues.v_bytes;
         _MADONVISI = EmptyValues.v_Int32;
         _MADONVILE = EmptyValues.v_Int32;
         _SOLUONGQUYDOI = EmptyValues.v_Int32;
         _VAT = EmptyValues.v_Int32;
         _CHIETKHAU = EmptyValues.v_double;
         _XUATXU = EmptyValues.v_string;
         _GIANHAP = EmptyValues.v_decimal;
         _GIALE = EmptyValues.v_decimal;
         _GIAQUYDINH = EmptyValues.v_decimal;
         _GIACHIATHANG = EmptyValues.v_decimal;
         _GIAKHUYENMAI = EmptyValues.v_decimal;
         _NGUONGNHAP = EmptyValues.v_decimal;
         _NGUONGXUAT = EmptyValues.v_decimal;
         _ISKHUYENMAI = EmptyValues.v_bool;
         _ISUSE = EmptyValues.v_bool;
         _ISDELETE = EmptyValues.v_bool;
         _ISTHEODOI = EmptyValues.v_bool;
         _NGAYTAO = EmptyValues.v_DateTime;
         _NGUOITAO = EmptyValues.v_string;
         _NGAYCAPNHAT = EmptyValues.v_DateTime;
         _NGUOICAPNHAT = EmptyValues.v_string;
         _MALOAIMATHANG = EmptyValues.v_Int32;
         _GHICHU = EmptyValues.v_string;
	_listHOADONXUATKHOCHITIET = null;
	_listHOADONHAPKHOCHITIET = null;
	_listKHOMATHANG = null;
	_listMATHANGKHUYENMAI = null;
        }

         
        #region Hidden

        /*
        private void readProperties(IDataReader reader)
        {
            try
            {
                                if(!(reader["MAMATHANG"] is DBNull))
		{
			obj.MAMATHANG = (Int32)reader["MAMATHANG"];
		}
                if(!(reader["MABARCODE"] is DBNull))
		{
			obj.MABARCODE = (string)reader["MABARCODE"];
		}
                if(!(reader["MACODE"] is DBNull))
		{
			obj.MACODE = (string)reader["MACODE"];
		}
                if(!(reader["TENMATHANG"] is DBNull))
		{
			obj.TENMATHANG = (string)reader["TENMATHANG"];
		}
                if(!(reader["HINHANH"] is DBNull))
		{
			obj.HINHANH = (byte[])reader["HINHANH"];
		}
                if(!(reader["MADONVISI"] is DBNull))
		{
			obj.MADONVISI = (Int32)reader["MADONVISI"];
		}
                if(!(reader["MADONVILE"] is DBNull))
		{
			obj.MADONVILE = (Int32)reader["MADONVILE"];
		}
                if(!(reader["SOLUONGQUYDOI"] is DBNull))
		{
			obj.SOLUONGQUYDOI = (Int32)reader["SOLUONGQUYDOI"];
		}
                if(!(reader["VAT"] is DBNull))
		{
			obj.VAT = (Int32)reader["VAT"];
		}
                if(!(reader["CHIETKHAU"] is DBNull))
		{
			obj.CHIETKHAU = (double)reader["CHIETKHAU"];
		}
                if(!(reader["XUATXU"] is DBNull))
		{
			obj.XUATXU = (string)reader["XUATXU"];
		}
                if(!(reader["GIANHAP"] is DBNull))
		{
			obj.GIANHAP = (decimal)reader["GIANHAP"];
		}
                if(!(reader["GIALE"] is DBNull))
		{
			obj.GIALE = (decimal)reader["GIALE"];
		}
                if(!(reader["GIAQUYDINH"] is DBNull))
		{
			obj.GIAQUYDINH = (decimal)reader["GIAQUYDINH"];
		}
                if(!(reader["GIACHIATHANG"] is DBNull))
		{
			obj.GIACHIATHANG = (decimal)reader["GIACHIATHANG"];
		}
                if(!(reader["GIAKHUYENMAI"] is DBNull))
		{
			obj.GIAKHUYENMAI = (decimal)reader["GIAKHUYENMAI"];
		}
                if(!(reader["NGUONGNHAP"] is DBNull))
		{
			obj.NGUONGNHAP = (decimal)reader["NGUONGNHAP"];
		}
                if(!(reader["NGUONGXUAT"] is DBNull))
		{
			obj.NGUONGXUAT = (decimal)reader["NGUONGXUAT"];
		}
                if(!(reader["ISKHUYENMAI"] is DBNull))
		{
			obj.ISKHUYENMAI = (bool)reader["ISKHUYENMAI"];
		}
                if(!(reader["ISUSE"] is DBNull))
		{
			obj.ISUSE = (bool)reader["ISUSE"];
		}
                if(!(reader["ISDELETE"] is DBNull))
		{
			obj.ISDELETE = (bool)reader["ISDELETE"];
		}
                if(!(reader["ISTHEODOI"] is DBNull))
		{
			obj.ISTHEODOI = (bool)reader["ISTHEODOI"];
		}
                if(!(reader["NGAYTAO"] is DBNull))
		{
			obj.NGAYTAO = (DateTime)reader["NGAYTAO"];
		}
                if(!(reader["NGUOITAO"] is DBNull))
		{
			obj.NGUOITAO = (string)reader["NGUOITAO"];
		}
                if(!(reader["NGAYCAPNHAT"] is DBNull))
		{
			obj.NGAYCAPNHAT = (DateTime)reader["NGAYCAPNHAT"];
		}
                if(!(reader["NGUOICAPNHAT"] is DBNull))
		{
			obj.NGUOICAPNHAT = (string)reader["NGUOICAPNHAT"];
		}
                if(!(reader["MALOAIMATHANG"] is DBNull))
		{
			obj.MALOAIMATHANG = (Int32)reader["MALOAIMATHANG"];
		}
                if(!(reader["GHICHU"] is DBNull))
		{
			obj.GHICHU = (string)reader["GHICHU"];
		}
//            _MAMATHANG = (reader["MAMATHANG"] is DBNull)?DalTools.EmptyValues.v_Int32:(Int32)reader["MAMATHANG"];
//            _MABARCODE = (reader["MABARCODE"] is DBNull)?DalTools.EmptyValues.v_string:(string)reader["MABARCODE"];
//            _MACODE = (reader["MACODE"] is DBNull)?DalTools.EmptyValues.v_string:(string)reader["MACODE"];
//            _TENMATHANG = (reader["TENMATHANG"] is DBNull)?DalTools.EmptyValues.v_string:(string)reader["TENMATHANG"];
//            _HINHANH = (reader["HINHANH"] is DBNull)?DalTools.EmptyValues.v_bytes:(byte[])reader["HINHANH"];
//            _MADONVISI = (reader["MADONVISI"] is DBNull)?DalTools.EmptyValues.v_Int32:(Int32)reader["MADONVISI"];
//            _MADONVILE = (reader["MADONVILE"] is DBNull)?DalTools.EmptyValues.v_Int32:(Int32)reader["MADONVILE"];
//            _SOLUONGQUYDOI = (reader["SOLUONGQUYDOI"] is DBNull)?DalTools.EmptyValues.v_Int32:(Int32)reader["SOLUONGQUYDOI"];
//            _VAT = (reader["VAT"] is DBNull)?DalTools.EmptyValues.v_Int32:(Int32)reader["VAT"];
//            _CHIETKHAU = (reader["CHIETKHAU"] is DBNull)?DalTools.EmptyValues.v_double:(double)reader["CHIETKHAU"];
//            _XUATXU = (reader["XUATXU"] is DBNull)?DalTools.EmptyValues.v_string:(string)reader["XUATXU"];
//            _GIANHAP = (reader["GIANHAP"] is DBNull)?DalTools.EmptyValues.v_decimal:(decimal)reader["GIANHAP"];
//            _GIALE = (reader["GIALE"] is DBNull)?DalTools.EmptyValues.v_decimal:(decimal)reader["GIALE"];
//            _GIAQUYDINH = (reader["GIAQUYDINH"] is DBNull)?DalTools.EmptyValues.v_decimal:(decimal)reader["GIAQUYDINH"];
//            _GIACHIATHANG = (reader["GIACHIATHANG"] is DBNull)?DalTools.EmptyValues.v_decimal:(decimal)reader["GIACHIATHANG"];
//            _GIAKHUYENMAI = (reader["GIAKHUYENMAI"] is DBNull)?DalTools.EmptyValues.v_decimal:(decimal)reader["GIAKHUYENMAI"];
//            _NGUONGNHAP = (reader["NGUONGNHAP"] is DBNull)?DalTools.EmptyValues.v_decimal:(decimal)reader["NGUONGNHAP"];
//            _NGUONGXUAT = (reader["NGUONGXUAT"] is DBNull)?DalTools.EmptyValues.v_decimal:(decimal)reader["NGUONGXUAT"];
//            _ISKHUYENMAI = (reader["ISKHUYENMAI"] is DBNull)?DalTools.EmptyValues.v_bool:(bool)reader["ISKHUYENMAI"];
//            _ISUSE = (reader["ISUSE"] is DBNull)?DalTools.EmptyValues.v_bool:(bool)reader["ISUSE"];
//            _ISDELETE = (reader["ISDELETE"] is DBNull)?DalTools.EmptyValues.v_bool:(bool)reader["ISDELETE"];
//            _ISTHEODOI = (reader["ISTHEODOI"] is DBNull)?DalTools.EmptyValues.v_bool:(bool)reader["ISTHEODOI"];
//            _NGAYTAO = (reader["NGAYTAO"] is DBNull)?DalTools.EmptyValues.v_DateTime:(DateTime)reader["NGAYTAO"];
//            _NGUOITAO = (reader["NGUOITAO"] is DBNull)?DalTools.EmptyValues.v_string:(string)reader["NGUOITAO"];
//            _NGAYCAPNHAT = (reader["NGAYCAPNHAT"] is DBNull)?DalTools.EmptyValues.v_DateTime:(DateTime)reader["NGAYCAPNHAT"];
//            _NGUOICAPNHAT = (reader["NGUOICAPNHAT"] is DBNull)?DalTools.EmptyValues.v_string:(string)reader["NGUOICAPNHAT"];
//            _MALOAIMATHANG = (reader["MALOAIMATHANG"] is DBNull)?DalTools.EmptyValues.v_Int32:(Int32)reader["MALOAIMATHANG"];
//            _GHICHU = (reader["GHICHU"] is DBNull)?DalTools.EmptyValues.v_string:(string)reader["GHICHU"];
            }
            catch (Exception ex)
            {
                throw new DalException("Failed to read properties from DataReader.", ex);
            }
        } 
        */

        #endregion


        public void Fill(Int32 MAMATHANG, string MABARCODE, string MACODE, string TENMATHANG, byte[] HINHANH, Int32 MADONVISI, Int32 MADONVILE, Int32 SOLUONGQUYDOI, Int32 VAT, double CHIETKHAU, string XUATXU, decimal GIANHAP, decimal GIALE, decimal GIAQUYDINH, decimal GIACHIATHANG, decimal GIAKHUYENMAI, decimal NGUONGNHAP, decimal NGUONGXUAT, bool ISKHUYENMAI, bool ISUSE, bool ISDELETE, bool ISTHEODOI, DateTime NGAYTAO, string NGUOITAO, DateTime NGAYCAPNHAT, string NGUOICAPNHAT, Int32 MALOAIMATHANG, string GHICHU)
        {
                     this._MAMATHANG = MAMATHANG;
         this._MABARCODE = MABARCODE;
         this._MACODE = MACODE;
         this._TENMATHANG = TENMATHANG;
         this._HINHANH = HINHANH;
         this._MADONVISI = MADONVISI;
         this._MADONVILE = MADONVILE;
         this._SOLUONGQUYDOI = SOLUONGQUYDOI;
         this._VAT = VAT;
         this._CHIETKHAU = CHIETKHAU;
         this._XUATXU = XUATXU;
         this._GIANHAP = GIANHAP;
         this._GIALE = GIALE;
         this._GIAQUYDINH = GIAQUYDINH;
         this._GIACHIATHANG = GIACHIATHANG;
         this._GIAKHUYENMAI = GIAKHUYENMAI;
         this._NGUONGNHAP = NGUONGNHAP;
         this._NGUONGXUAT = NGUONGXUAT;
         this._ISKHUYENMAI = ISKHUYENMAI;
         this._ISUSE = ISUSE;
         this._ISDELETE = ISDELETE;
         this._ISTHEODOI = ISTHEODOI;
         this._NGAYTAO = NGAYTAO;
         this._NGUOITAO = NGUOITAO;
         this._NGAYCAPNHAT = NGAYCAPNHAT;
         this._NGUOICAPNHAT = NGUOICAPNHAT;
         this._MALOAIMATHANG = MALOAIMATHANG;
         this._GHICHU = GHICHU;
        }
    }
}